<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>苏宁易购：我的订单</title>  
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<link rel="shortcut icon" href="http://localhost/project/shop/Static/Index/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="http://localhost/project/shop/Static/Index/Css/global.css" />
<link rel="stylesheet" href="http://localhost/project/shop/Static/Index/Css/cart.css" />
<link rel="stylesheet" href="http://localhost/project/shop/Static/Index/Css/hdjs.css" />
<link rel="stylesheet" href="http://localhost/project/shop/Static/Index/Css/order.css" />

<script type="text/javascript" src="http://localhost/project/shop/Static/Index/Js/jquery.min.js"></script>
<script type="text/javascript" src="http://localhost/project/shop/Static/Index/Js/common.js"></script>
<script type="text/javascript" src="http://localhost/project/shop/Static/Index/Js/hdjs.min.js"></script>

<script type="text/javascript" src="http://localhost/project/shop/Static/Index/Js/scrolltopcontrol.js"></script>
<!--[if IE 6]>
<script type="text/javascript" src="http://localhost/project/shop/Static/Index/Js/DD_belatedPNG.js"></script>
<script>
    DD_belatedPNG.fix(".img_logo", "img");
</script>
<![endif]-->
</head>
<body>
	 
<div class="cart_main">
	<div class="clogo"><a href="http://localhost/project/shop"></a></div>
	<div class="r cart_progress">
		<dl>
			<dt class="finish"><i>1</i><span>我的购物车</span></dt>
			<dt class="finish"><i>2</i><span>确认订单</span></dt>
			<dt><i>3</i><span>付款</span></dt>
			<dt><i>4</i><span>支付成功</span></dt>
		</dl>
	</div>

</div>
<div class="cart_title cart_t2"><p>配送信息</p><a href="javascript:void(0)" class="ah ah1" style="color: #f90">新增收货地址</a></div>
<script type="text/javascript">
    var g_adid = "21";

    $(function(){

        $('.add_address').hide();
        $('.ah1,msg_ok').toggle(function(){
            $('.add_address').stop().slideDown(500);
            $('.cart_t2 .ah1').html("取消");
        },function(){
            $('.add_address').stop().slideUp(500);
            $('.cart_t2 .ah1').html("新增收货地址");
        })


        $('.ah2').click(function(){
            $('.add_address').stop().slideDown(500);
            $('.cart_t2 .ah1').html("取消");
        })



        // 修改地址
        $('.edit_address').click(function(){
            var adid = $(this).attr('adid');
            // alert(adid);
            $.ajax({
                type:'post',
                url:"<?php echo U('edit_address');?>",
                data:'adid=' + adid,
                dataType:'json',
                success:function(phpData){
                    $('.add_address').html("<table class='hd-form hd-table hd-table-form'><thead>"+
        "<tr><td colspan='2'>新增收货地址</td></tr></thead>"+
        "<tbody><tr><th class='hd-w150'>收货人</th><td><input name='consignee' type='text' value='"+phpData.consignee+"'>"+
        "</td></tr><tr><th>手机</th><td><input name='mobile' type='text' value='"+phpData.mobile+"'></td></tr>"+
        "<tr><th>收货地址</th><td><textarea name='address' cols='50' rows='1' style='resize:none'>"+phpData.address+"</textarea></td></tr>"+
        "<tr><th></th><td><label><input name='isdefault' value='1'     <?php if("+phpData.isdefault==1+"){ ?>checked<?php } ?> type='checkbox'>设置为默认收货地址</label>"+
        "<input type='hidden' name='adid' value='"+phpData.adid+">"+
        "<span id='hd_mood'></span></td></tr></tbody></table>"+
        "<input value='确认配送信息' class='hd-btn hd-btn-sm msg_ok' type='submit'>");
                }
            })
        })
    })
</script>
<div class="address" style="margin-top:10px">
<table border="" cellspacing="" cellpadding="" class="mber_r">
    <tr>
        <td width=70px;>收货人</td>
        <td width=520px;>详细地址</td>
        <td width=80px;>电话/手机</td>
        <td width=60px;>是否默认</td> 
        <td width=60px;>是否修改</td> 
        <td width=60px;>是否删除</td>
    </tr>

    <?php foreach ($a_data as $k=>$v){?>
        <tr     <?php if($v['isdefault'] ==1){ ?>style="background:#eee"<?php } ?>>
            <td><?php echo $v['consignee'];?></td>
            <td><?php echo $v['address'];?></td> 
            <td><?php echo $v['mobile'];?></td>
            <td>
                    <?php if($v['isdefault'] ==1){ ?>默认地址
                <?php }else{ ?>
                    <a href="<?php echo U('is_default',array('adid'=>$v['adid']));?>">设为默认</a>
                <?php } ?>
            </td>
            <td>
                <a href="javascript:void(0)" adid='<?php echo $v['adid'];?>' class="edit_address ah2">修改</a>
            </td>
            <td>
                <a href="<?php echo U('del_address',array('adid'=>$v['adid'],'isdefault'=>$v['isdefault']));?>">删除</a>
            </td>
        </tr>
    <?php }?>
</table>
<!--表单验证Start-->
<script>
    $(function () {
        $('#HDJS').validate({
            username: {
                rule: {
                    required: true
                },
                error: {
                    required: '收货人名不能为空'
                },
                success: '验证通过',
                message: '收货人名'
            }, 
            mobile: {
                rule: {
                    phone: true
                },
                error: {
                    phone: '手机号错误'
                }
            }, 
        }) 

    })
</script>
<!--表单验证End-->
<form id="HDJS" action="<?php echo U('address');?>" method="post" class="add_address">
    <table class="hd-form hd-table hd-table-form">
        <thead>
        <tr>
            <td colspan="2">新增收货地址</td>
        </tr>
        </thead>
        <tbody>

        <tr>
            <th class="hd-w150">收货人</th>
            <td>
                <input name="consignee" type="text">
            </td>
        </tr>
        <tr>
            <th>手机</th>
            <td>
                <input name="mobile" type="text">
            </td>
        </tr> 

    	<tr>
            <th>收货地址</th>
            <td>
                <textarea name="address" cols="50" rows="1" style="resize:none"></textarea>
            </td>
        </tr>

        <tr>
            <th></th>
            <td>
                <label><input name="isdefault" value="1" type="checkbox"> 设置为默认收货地址</label> 
                <span id="hd_mood"></span>
            </td>
        </tr>
        
        </tbody>
    </table>
    <input value="确认配送信息" class="hd-btn hd-btn-sm msg_ok" type="submit">
</form>
</div>
<div class="cart_title cart_title2"><p>商品信息及服务信息</p><a href="<?php echo U('Cart/index');?>" class="ah" style="color: #f90">回购物车修改商品</a></div>

	<table id="cart">
		<thead>
			<tr>
				<th>商品信息</th>
				<th>商品价格（元）</th>
				<th>数量</th>  
				<th>服务信息</th>
			</tr>
		</thead>
		<tbody>
			<?php foreach ($cart['goods'] as $k=>$v){?>
				<tr>
					<td class='name'>
						<img src="http://localhost/project/shop/<?php echo $v['pic'];?>" width='100' height='100' alt="" />
						<a href="javascript:void(0)"><?php echo $v['name'];?></a>
					</td>
					<td class='price'>￥<?php echo $v['price'];?></td>
					<td class='number number2'><?php echo $v['num'];?></td> 
					<td class='name'>
						<ul>
							<li>免运费</li>
							<li>支付完成后尽快为您发货如有疑问请联系123</li>
						</ul>
					</td> 
				</tr>
			<?php }?>
			<tr>
				<td colspan='6' class='count'>
					<div class='total2'>
						<p><b>应付金额：</b><span id='sub'>￥<?php echo $cart['total'];?></span></p>
						<p><b>收货地址：</b><?php echo $address_data['address'];?></p>
						<p><b>收货人：</b><?php echo $address_data['consignee'];?> <?php echo $address_data['mobile'];?></p>
					</div>
					<div class='sub-btn'>
						<a href="<?php echo U('add_order');?>" class="buy_ok"></a>
					</div>
				</td>
			</tr>
		</tbody>
	</table>
<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!--S foot -->
<div class="foot2"> 
	<div class="foot2_c">
		<dl class="dl_f2">
			<dt class="dt_f2_s"><a href="http://www.houdunwang.com/">后盾网</a></dt> 
			<dt class="dt_f2_s"><a href="http://bbs.houdunwang.com/">后盾网论坛</a></dt>
			<dt class="dt_f2_s"><a href="http://www.baidu.com">百度</a></dt>
		</dl>
		<p class="p_w">Copyright © 2015-2015<span>***.com</span><a>易购</a>All Rights Reserved.<a>京ICP备********号</a></p>
		<img src="http://localhost/project/shop/Static/Index/Images/i_bg.jpg" alt="" class="in_img">
	</div>
</div>
</body>
</html>